/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.ufrgs.inf.prav.interop.jsf.components;

import java.io.IOException;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;

/**
 *
 * @author Fernando
 */
public class StyleComponent extends PravBaseComponent {

    public static final String COMPONENT_FAMILY = "PRAV_STYLE";
    public static final String COMPONENT_TYPE = "PRAV_STYLE";

    private String type, media;

    public StyleComponent(){
        
    }

    @Override
    public void encodeBegin(FacesContext context) throws IOException {
        if (!displayPlataform()){
            hideInnerComponents();
            return;
        }

		ResponseWriter writer =
			context.getResponseWriter();
		writer.startElement("style", this);


        //atts
        writer.writeAttribute("media", media, "media");
        writer.writeAttribute("type", type, "type");

        addBaseAttributes(writer);

        writer.flush();

	}

    @Override
    public void encodeEnd(FacesContext context)
            throws IOException {
        if (!displayPlataform())
            return;
        ResponseWriter writer = context.getResponseWriter();
        writer.endElement("style");
        writer.flush();
//        return;
    }

    @Override
    public void decode(FacesContext context) {
    }

    // <editor-fold defaultstate="collapsed" desc="Getters and Setters">
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getMedia() {
        return media;
    }

    public void setMedia(String media) {
        this.media = media;
    }
    // </editor-fold>

}
